﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RCREEE.Web
{
    public partial class CountrySelector : System.Web.UI.Page
    {
        public int LanguageCode
        {
            get
            {
                int langCode = 0;
                if (Session["LanguageCode"] != null)
                    int.TryParse(Session["LanguageCode"].ToString(), out langCode);
                return langCode;
            }
            set
            {
                Session["LanguageCode"] = value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            System.Data.DataTable dtCountries = RCREEE.Library.DataManager.GetAllCountries(LanguageCode, "");
            if (dtCountries.Rows.Count < 0) return;
            else
                if (dtCountries.Rows[0]["CountryId"].ToString() == "0") dtCountries.Rows.RemoveAt(0);
            dlCountries.DataSource = dtCountries;
            dlCountries.DataBind();
        }
    }
}